<template>
  <section class="todoapp">
    <todo-header></todo-header>
    <todo-main :list="list" @del="delFn"></todo-main>
    <todo-footer></todo-footer>
  </section>
</template>

<script>
import TodoHeader from "./components/todo-header.vue";
import TodoMain from "./components/todo-main.vue";
import TodoFooter from "./components/todo-footer.vue";
export default {
  components: {
    TodoHeader,
    TodoMain,
    TodoFooter,
  },
  data() {
    return {
      list: [
        { id: 1, name: "吃饭", isDone: true },
        { id: 2, name: "睡觉", isDone: false },
        { id: 3, name: "打豆豆", isDone: true },
      ],
    };
  },
  methods: {
    delFn(id) {
      console.log(id);
      this.list = this.list.filter((item) => item.id !== id);
    },
  },
};
</script>

<style></style>
